Fix formatter spacing for JSON path operators (->, ->>)#637
Fix formatter spacing for JSON path operators (->, ->>)#637Sea-n wants to merge 1 commit intophpmyadmin:masterfrom
Conversation
|
CC @MauricioFauth and @williamdes, |
- Treat `->` and `->>` as SQL operators in the lexer.
- Prevent formatter from inserting spaces around JSON path operators.
- Add formatter test for JSON path access.
For example:
```sql
SELECT
details->'$."first_name"'
FROM
users;
```
Signed-off-by: Sean Wei <me@sean.taipei>
williamdes
left a comment
There was a problem hiding this comment.
This looks okay, thank you for adding a test
I will wait for another review from anyone else
|
Ping @MauricioFauth again, |
|
Thanks again for the reviews! I noticed two checks are still failing on this PR:
Do these failures look related to my changes? If so, I’m happy to fix them right away. Also, if rebasing onto the latest master would help, I can do that and push a follow-up quickly. |
|
The Lint and analyze error is from a new Psalm version, not related to your changes. @williamdes @MauricioFauth As a bug fix, should this go to 5.11.x? |
Exactly, I did not merge this yet because of that. |
Summary
->and->>as SQL operators in the lexer.For example:
SELECT details->'$."first_name"' FROM users;Expected:
Actual:
Caused SQL syntax error.
Tests
./vendor/bin/phpunitpassedI didn’t run
./vendor/bin/phpcbfas suggested in CONTRIBUTING.md because it currently changes about 60 files and produces roughly 150 lines of diff. If you’re okay with it, I’d love to handle that in a separate PR.References